Generate FM Signal with HackRF SDR and GNURadio Companion
📡 GNURadio is an excellent fit for all hacks around signal processing. Since setting it up on several OS X environments always created one pitfall or another I decided to write down the happy path most likely being successful 🤡
If not already done so, install Conda in order to manage Python environments. This makes sure all is self contained and the GNURadio setup doesn't interfere or disturb existing projects.
Therefore install Miniconda or Anaconda from https://docs.conda.io/en/latest/miniconda.html
Choose a package and install. Afterwards, open a fresh terminal session and create a Conda environment:
>conda create -n gnuradio
Enter the environment by activating it with the command:
>conda activate gnuradio
Before installing the GNU Radio packages, we need to ensure that the environment is set up to look for packages from conda-forge:
>conda config --env --add channels conda-forge
>conda config --env --set channel_priority strict
It seems that running GNURadio with Python 3.10 has some trouble with retina on Big Sur. Even the scale_factor fixes did not do the trick on my machine, thus:
>conda install gnuradio python=3.8
>conda install soapysdr-module-hackrf
>conda install gnuradio-build-deps
>conda upgrade --all
Afterwars the GNURadio tools should be available in the Conda environment. Start the Companion with:
>gnuradio-companion
🤔 For some reason I got some trouble with the device but installing HackRF from MacPorts worked fine:
>sudo port install hackrf
On a side note I need to mention that GQRX always quits with a segmentation fault 🧨 in the same Conda env. Maybe someone has an idea what the root cause might be...
Anyways: off creating a FM Transponder and Receiver
FM Transponder
After firing up GNURadio Companion this is a walk in the park. Let's consider having a WAV File as audio source as well as the computer's microphone.
Since we have to check on the sampling rate of a couple of components let's have look at the source and receiver.
I have an audio source file with a sample rate of 11kHz. For the sake of simplicity we are using Gqrx (https://gqrx.dk) in order to have convenient method of testing our outputs (thus I'm using two SDR, a HackRF One for transmitting and RTL.SDR for receiving).